home *** CD-ROM | disk | FTP | other *** search
/ Compendium Deluxe 2 / LSD and 17bit Compendium Deluxe - Volume II.iso / a / prog / misc / gfront11.lha / GUIFront / Demos / Source / exchange.c < prev    next >
C/C++ Source or Header  |  1994-11-01  |  4KB  |  143 lines

  1.  
  2. /* Exchange.c - The GUI of the 'Exchange' utility
  3.  *
  4.  * This is a GUIFront example GUI. To build an example, compile and link this
  5.  * file with Generic.o (also supplied).
  6.  * Everything prefixed with DEMO_ is exported to Generic.o.
  7.  */
  8.  
  9. #include <libraries/guifront.h>
  10.  
  11. /* First, some Gadget ID's */
  12.  
  13. enum
  14. {
  15.     GID_CXLIST,
  16.     GID_INFO,
  17.     GID_SHOW,
  18.     GID_HIDE,
  19.     GID_ACTIVATE,
  20.     GID_REMOVE,
  21. };
  22.  
  23. /* Some data and tag items we'll be needing later */
  24.  
  25. static const STRPTR activatelabels[] =
  26. {
  27.     "Active",
  28.     "Inactive",
  29.     NULL,
  30. };
  31.  
  32. static const struct TagItem activatetags[] =
  33. {
  34.     {GTCY_Labels, activatelabels},
  35.     {TAG_DONE},
  36. };
  37.  
  38. extern struct MinList cxlistlabels;
  39.  
  40. static struct Node cxlistnodes[] =
  41. {
  42.     {&cxlistnodes[1], (struct Node *)&cxlistlabels.mlh_Head, 0, 0, "AlertPatch"},
  43.     {&cxlistnodes[2], &cxlistnodes[0], 0, 0, "CScreen"},
  44.     {&cxlistnodes[3], &cxlistnodes[1], 0, 0, "CxAltNum"},
  45.     {&cxlistnodes[4], &cxlistnodes[2], 0, 0, "CxKeyClose"},
  46.     {&cxlistnodes[5], &cxlistnodes[3], 0, 0, "CycleToMenu"},
  47.     {&cxlistnodes[6], &cxlistnodes[4], 0, 0, "Exchange"},
  48.     {&cxlistnodes[7], &cxlistnodes[5], 0, 0, "PowerCache"},
  49.     {&cxlistnodes[8], &cxlistnodes[6], 0, 0, "RetinaComm"},
  50.     {&cxlistnodes[9], &cxlistnodes[7], 0, 0, "RetinaEMU"},
  51.     {&cxlistnodes[10], &cxlistnodes[8], 0, 0, "ToolManager"},
  52.     {(struct Node *)&cxlistlabels.mlh_Tail, &cxlistnodes[9], 0, 0, "WindX"},
  53. };
  54.  
  55. struct MinList cxlistlabels =
  56. {
  57.     (struct MinNode *)&cxlistnodes[0], NULL,(struct MinNode *)&cxlistnodes[10]
  58. };
  59.  
  60. static const struct TagItem cxlisttags[] =
  61. {
  62.     {GTLV_ShowSelected, NULL},
  63.     {GTLV_Labels, &cxlistlabels},
  64.     {TAG_DONE},
  65. };
  66.  
  67. static const struct TagItem infotags[] =
  68. {
  69.     {GTTX_Border, TRUE},
  70.     {TAG_DONE},
  71. };
  72.  
  73. /* Now, the GadgetSpec's we'll be needing for this GUI */
  74.  
  75. static GadgetSpec gadgetspecs[] =
  76. {
  77.     {LISTVIEW_KIND,30,6, {0,0,0,0,"Available Commodities", NULL, GID_CXLIST, PLACETEXT_ABOVE}, cxlisttags, GS_DefaultTags},
  78.     {TEXT_KIND,     0,2, {0,0,0,0,"Information", NULL, GID_INFO, PLACETEXT_ABOVE}, infotags, GS_DefaultTags},
  79.     {BUTTON_KIND,   0,0, {0,0,0,0,"Show Interface", NULL, GID_SHOW, PLACETEXT_IN}, NULL, GS_DefaultTags},
  80.     {BUTTON_KIND,   0,0, {0,0,0,0,"Hide Interface", NULL, GID_HIDE, PLACETEXT_IN}, NULL, GS_DefaultTags},
  81.     {CYCLE_KIND,    0,0, {0,0,0,0,NULL,NULL,GID_ACTIVATE,PLACETEXT_LEFT},activatetags,GS_DefaultTags},
  82.     {BUTTON_KIND,   0,0, {0,0,0,0,"Remove", NULL, GID_REMOVE, PLACETEXT_IN}, NULL, GS_DefaultTags},
  83. };
  84.  
  85. /* Now, we group all of these GadgetSpecs into an array of pointers, so the
  86.  * layout engine can locate gadgets merely by their Gadget IDs.
  87.  */
  88.  
  89. GadgetSpec *DEMO_GadgetSpecList[] =
  90. {
  91.     &gadgetspecs[0], &gadgetspecs[1], &gadgetspecs[2], &gadgetspecs[2],
  92.     &gadgetspecs[3], &gadgetspecs[4], &gadgetspecs[5], NULL,
  93. };
  94.  
  95. /* Finally, the layout tag list itself. This is where most of the work is
  96.  * done. This list completely describes how the above gadgets are arranged
  97.  * in groups in the GUI.
  98.  */
  99.  
  100. ULONG DEMO_LayoutList[] =
  101. {
  102.     GUIL_Flags, GUILF_PropShare,
  103.  
  104.     GUIL_GadgetSpecID, GID_CXLIST,
  105.  
  106.     GUIL_VertGroup, 1,
  107.         GUIL_Flags, GUILF_PropShare | GUILF_EqualWidth,
  108.         GUIL_GadgetSpecID, GID_INFO,
  109.  
  110.         GUIL_HorizGroup, 1,
  111.             GUIL_Flags, GUILF_EqualShare,
  112.             GUIL_GadgetSpecID, GID_SHOW,
  113.             GUIL_GadgetSpecID, GID_HIDE,
  114.         TAG_DONE,
  115.  
  116.         GUIL_HorizGroup, 1,
  117.             GUIL_Flags, GUILF_EqualShare,
  118.             GUIL_GadgetSpecID, GID_ACTIVATE,
  119.             GUIL_GadgetSpecID, GID_REMOVE,
  120.         TAG_DONE,
  121.     TAG_DONE,
  122.  
  123.     TAG_DONE,
  124. };
  125.  
  126. /* Obligatory version tag */
  127.  
  128. static const char ver[] = "$VER: Exchange 1.0 " __AMIGADATE__;
  129.  
  130. /* Now, some globals used by Generic.o during the call to GF_CreateGUIA() */
  131.  
  132. int DEMO_InitialOrientation = GUIL_HorizGroup;
  133.  
  134. STRPTR DEMO_WindowTitle = "Exchange GUI";
  135. STRPTR DEMO_AppID       = "Exchange";
  136.  
  137. STRPTR DEMO_Version     = "1.0",
  138.        DEMO_LongDesc    = "Demo program - Exchange",
  139.        DEMO_Author      = "Michael Berg",
  140.        DEMO_Date        = __AMIGADATE__;
  141.  
  142. BOOL   DEMO_Backfill    = FALSE;
  143.